package com.qztech.sdk.model.dao;

import androidx.room.Dao;
import androidx.room.Delete;
import androidx.room.Insert;
import androidx.room.OnConflictStrategy;
import androidx.room.Query;
import androidx.room.Update;

import com.qztech.sdk.model.entities.UserProfile;

import java.util.List;

import io.reactivex.Flowable;

/**
 * @author:zhanghb
 * @date:2019/1/27
 * @email:2573475062@qq.com
 **/
@Dao
public interface UserProfileDao {

    @Insert(onConflict = OnConflictStrategy.REPLACE )
    void insert(UserProfile userProfile);

    @Update()
    void update(UserProfile userProfile);

    @Delete
    void delete(UserProfile userProfile);

    @Query("SELECT * FROM user_profile Where mode =:mode order by createTime limit 100")
    Flowable<List<UserProfile>> getUserProfiles(int mode);
}
